import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

// https://vite.dev/config/
export default defineConfig({
    plugins: [
        vue(),
        AutoImport({
            resolvers: [ElementPlusResolver()],
        }),
        Components({
            resolvers: [ElementPlusResolver()],
        }),
    ],
    base: './',
    build: {
        target: 'esnext',
        terserOptions: {
            compress: {
                drop_console: true,
                drop_debugger: true
            }
        }
        ,
        rollupOptions: {
            output: {
                chunkFileNames: 'static/js/[name]-[hash].js',
                entryFileNames: 'static/js/[name]-[hash].js',
                assetFileNames: 'static/[ext]/[name]-[hash].[ext]'
            }
        }
    },
    //   server: {
    //     proxy: {
    //       '/userApi': {
    //         target: '8.153.175.159/api',
    //         changeOrigin: true,
    //         rewrite: (path) => path.replace(/^\/userApi/, '')
    //       }
    //     }
    //   },
    resolve: {
        alias: {
            '@': '/src'
        }
    }
})
